package com.xiaoKe.zhonghzu.global.tool;

import android.text.TextUtils;


import com.xiaoKe.zhonghzu.global.base.BaseApplication;

import java.util.Locale;

/**
 * @ProjectName : app
 * @Author : Shijingna
 * @Time : 2023/1/4 1:40 下午
 * @Description : 获取语言
 */
public class Language {
    /**
     * 其中languag为语言码：
     * zh：汉语
     * en：英语
     */
    public static boolean isEn() {
        String lan = SPUtils.getString( "lan", "");
        if (!TextUtils.isEmpty(lan)) {
            if (lan.equals("EN")){
                return true;
            }
        }
        Locale locale = BaseApplication.instance.getResources().getConfiguration().locale;
        String language = locale.getLanguage();
        if (language.endsWith("en"))
            return true;
        else
            return false;
    }
    public static boolean isZh() {
        String lan = SPUtils.getString("lan", "");
        if (!TextUtils.isEmpty(lan)) {
            if (lan.equals("CN")){
                return true;
            }
        }
        Locale locale = BaseApplication.instance.getResources().getConfiguration().locale;
        String language = locale.getLanguage();
        if (language.endsWith("zh"))
            return true;
        else
            return false;
    }


}
